<?php
namespace app\index\controller;
use think\Controller;
use think\Session;
class Base extends Controller{	
    public function _initialize()
    {
		//页面初始化判断是否登陆
    	$info=db('user')->where('username',Session::get('username'))->find();
		$username=$info['username'];
    	$this->assign('username',$username);
    	$Li=db('cate')->where('id',11)->select();
		$this->assign('Li',$Li); 
		$co=db('cate')->where('id',9)->select();
		$this->assign('co',$co); 
		$xs=db('cate')->where('id',14)->select();
		$this->assign('xs',$xs);
		$rm=db('cate')->where('id',9)->select();
		$this->assign('rm',$rm);
		$Cz=db('cate')->where('id',3)->select();
		$this->assign('Cz',$Cz);
		$Hf=db('cate')->where('id',10)->select();
		$this->assign('Hf',$Hf);
		$Zq=db('cate')->where('id',12)->select();
		$this->assign('Zq',$Zq);
		//查找栏目标题和标签渲染输出
    	// $cateres=db('cate')->order('id asc')->select();
        // $tagres=db('tags')->order('id desc')->select();
    	// $this->assign(array(
        //     'cateres' => $cateres,
        //     'tagres' => $tagres
        //     ));
    }
	
	public function logout(){//销毁session
		session("username", NULL);//跳转页面
		$this->success('注销成功！','Index/index');
	}
}